$(function(){

getSchool();
//获取search
 function getSchool(){
    var sar=$.trim(decodeURI(location.search).toString().substring(8));
    if(sar==""){
        $('.sel_school').text('选择学校');
    }else{
        $('.sel_school').text(sar);
        $('#sel_school').val(sar);
    }

 }

$('.b_joinc').on('click',function(){
    $('.line input').each(function(){
        if($(this).val()==''){
             layer.open({
                content:'请完整填写信息',
                title:'',
                style: 'width:80%;border:none; background-color:#222222; color:#fff;'
            });
        }
        return false;
     });
});


//选择地市
$('.sel_area').on('click',function(){
    //判断如果该值改变，清空学校和班级
    var picker=new mui.PopPicker({layer:3});
    picker.setData(hndata);
    picker.show(function(selectItem){
    var sch=selectItem[0].text+selectItem[1].text+selectItem[2].text;
    $('.sel_area').text(sch);
    $('#sel_area').val(sch);
});
});

//选择班级
var dataclass=[{
    text:'小学',
    value:'1',
    children:[{
        text:'一年级',
        value:'1_1',
        children:[{
            text:'1班',
            value:'1_1_1'
        },{
            text:'2班',
            value:'1_1_2'
        },{
            text:'3班',
            value:'1_1_3'
        },{
            text:'4班',
            value:'1_1_4'
        }]
    },{
        text:'二年级',
        value:'1_2',
        children:[{
            text:'1班',
            value:'1_2_1'
        },{
            text:'2班',
            value:'1_2_2'
        },{
            text:'3班',
            value:'1_2_3'
        },{
            text:'4班',
            value:'1_2_4'
        }]
    },{
        text:'三年级',
        value:'1_3',
        children:[{
            text:'1班',
            value:'1_3_1'
        },{
            text:'2班',
            value:'1_3_2'
        },{
            text:'3班',
            value:'1_3_3'
        },{
            text:'4班',
            value:'1_3_4'
        }]
    },{
        text:'四年级',
        value:'1_4',
        children:[{
            text:'1班',
            value:'1_4_1'
        },{
            text:'2班',
            value:'1_4_2'
        },{
            text:'3班',
            value:'1_4_3'
        },{
            text:'4班',
            value:'1_4_4'
          }]
        },{
        text:'五年级',
        value:'1_5',
        children:[{
            text:'1班',
            value:'1_5_1'
        },{
            text:'2班',
            value:'1_5_2'
        },{
            text:'3班',
            value:'1_5_3'
        },{
            text:'4班',
            value:'1_5_4'
            }]
        },{
        text:'六年级',
        value:'1_6',
        children:[{
            text:'1班',
            value:'1_6_1'
        },{
            text:'2班',
            value:'1_6_2'
        },{
            text:'3班',
            value:'1_6_3'
        },{
            text:'4班',
            value:'1_6_4'
        }]
    }]
}];

$('.sel_class').on('click',function(){
    var picker1=new mui.PopPicker({layer:3});
    picker1.setData(dataclass);
    picker1.show(function(selectItem){
        var cls=selectItem[0].text+selectItem[1].text+selectItem[2].text;
        $('.sel_class').text(cls);
        $('#sel_class').val(cls);
    });
});



});